package cn.wolfcode.wolf2w.redis.util;

import cn.wolfcode.wolf2w.util.Consts;
import lombok.Getter;

@Getter
public enum RedisKeys {
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME * 60L),
    STRATEGY_FAVOR_VO("strategy_favor_vo", -1L),//约定-1L为不设置时效
    STRATEGY_THUMBUP_VO("STRATEGY_THUMBUP_VO", -1L),//约定-1L为不设置时效
    STRATEGY_STATIS_VO("strategy_statis_vo", -1L),//约定-1L为不设置时效
    TRAVEL_STATIS_VO("travel_statis_vo", -1L),//约定-1L为不设置时效
    TRAVEL_THUMBUP_VO("strategy_thumbup_vo", -1L),//约定-1L为不设置时效
    LOGIN_TOKEN("login_token", Consts.USER_INFO_TOKEN_VAI_TIME * 60L),
    SET_TIME("set_time",Consts.SET_VAI_TIME  * 60L);
    private String prefix;
    private Long time;

    RedisKeys(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

    public String join(String... values){
        StringBuilder sb = new StringBuilder(80);
        sb.append(this.prefix);
        for (String val:values
             ) {
            sb.append(":").append(val);
        }
        return sb.toString();
    }
}
